package com.ds.dsfans.liteflow.demo.mysql;

import com.yomahub.liteflow.core.FlowExecutor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class LiteFlowCommand1 implements CommandLineRunner {
    @Resource
    private FlowExecutor flowExecutor;

    @Override
    public void run(String... args) throws Exception {
//        while (true) {
//            LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
//            DefaultContext context = response.getFirstContextBean();
//            System.out.println(JsonUtil.toJsonString(context.getData("student")));
//            if (response.isSuccess()) {
//                log.info("执行成功");
//            } else {
//                log.info("执行失败");
//            }
//            Thread.sleep(1000);
//        }
    }
}
